<template>
	<view class="main">
		<!---list start -->
		<block v-if="listRow.length>0"></block>
		<view class="user-followList" v-for="(item,index) in listRow" :key="index">
			<view class="follow-list poser dis-row" @click="openJob(item)">
				<view class="follow-face"><image :src="item.avatar?item.avatar:'http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg'"></image></view>
				<view class="follow-info dis-clm">
					<view class="user-item dis-row">
						<view class="useritem-name">{{item.nickName}}</view>
						<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg"></image></label>
						<text>已实名</text>
					</view>
				<!-- 	<view class="useritem-text dis-row" v-if="item.isRealName ==1 && item.isEnterprise==0"> -->
					<view class="useritem-text dis-row" v-if="!item.enterpriseName|| item.enterpriseName == null">
						<block>
						 <label>在招好活</label><text>{{item.num}}</text>
						</block>
					</view>
					<view class="useritem-text dis-row" v-if="(item.isRealName ==1 && item.isEnterprise==1) ||(item.isRealName ==0 && item.isEnterprise==1)">
						<block v-if="item.enterpriseName">
							<view class="user-qiyeico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/comp-real.svg"></image></view>
							<view class="user-qiyetext">{{item.enterpriseName}}</view>
						</block>
				<!-- 		<block v-else v-if="!item.enterpriseName|| item.enterpriseName == null">
						 <label>在招好活</label><text>{{item.num}}</text>
						</block> -->
					</view>
				</view>
				<view class="ps-text">{{item.createTime.split(' ')[0]}}</view>
			</view>
		</view>
		</block>
		<!--list over-->
		<block v-if="listRow.length == 0">
			<view class="empty-img">
				<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
				<label>暂无内容</label>
			</view>
		</block>
		<!---list start -->
		<!-- <view class="user-followList">
			<view class="follow-list poser dis-row">
				<view class="follow-face"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg"></image></view>
				<view class="follow-info dis-clm">
					<view class="user-item dis-row">
						<view class="useritem-name">王先生</view>
						<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg"></image></label>
						<text>已实名</text>
					</view>
					<view class="useritem-text dis-row">
						<label>暂无在招好活</label>
					</view>
				</view>
				<view class="ps-text">今天</view>
			</view>
		</view> -->
		<!--list over-->
		
		<!---list start -->
		<!-- <view class="user-followList">
			<view class="follow-list poser dis-row">
				<view class="follow-face"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg"></image></view>
				<view class="follow-info dis-clm">
					<view class="user-item dis-row">
						<view class="useritem-name">王先生</view>
					</view>
					<view class="useritem-text dis-row">
						 <view class="user-qiyeico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/comp-real.svg"></image></view>
						 <view class="user-qiyetext">陕西新工建筑工程有限公司</view>
					</view>
				</view>
				<view class="ps-text">10月14日</view>
			</view>
		</view> -->
		<!--list over-->
		
		<u-popup
			:show="userJob" 
			:round="10" 
			customStyle="width:100%;" 
			overlayOpacity="0.8"
			mode="bottom"
			:closeable="true" 
			@close="closeJob" 
			@open="openJob"
			>
			<view class="userJobList">
				<view class="top">
					<view class="user">
						<block v-if="orderinfo.isRealName==1">
						    <image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg" style="width: 48rpx;height: 48rpx;" />
						</block>
						<view>{{nickName}}的招工</view>
					</view>
					<view class="number">在招信息<text>{{userListOrder.length>0?userListOrder.length:0}}</text>个</view>
				</view>
				<scroll-view scroll-y="true" sty class="scroll-Y">
						<view class="list" v-for="(jitem,jindex) in userListOrder" :key="jindex" >
							<view class="title"  @click="navUserOrderInfo(jitem)">
							<!-- 	<text class="tips">置顶</text> -->
								<view style="width: 100%;text-align: left;">{{jitem.titleName,63}}</view>
						    </view>
						  <view class="cont"
							>{{jitem.workDesc}}</view
						  >
						  <view class="tag"  @click="navUserOrderInfo(jitem)">
							<view class="t1" v-if="jitem.salaryStr!=''">{{jitem.salaryStr}}</view>
							<view v-if="jitem.settlementStr!=''">{{jitem.settlementStr}}</view>
							<block v-if="jitem.welfareNew">
								<block v-for="(childitem,childindex) in jitem.welfareNew" :key="childindex">
									<view v-if="childitem">{{childitem}}</view>
								</block>
							</block>
						  </view>
						  <view class="info">
							<view class="left">
							  <view class="addr">
								<u-icon name="map" color="#A1A1A1" size="13"></u-icon>
								 {{jitem.cityArea}} ·{{jitem.createTime}}
							  </view>
							</view>
							<view class="right" @click="navUserOrderInfo(jitem)">查看详情</view>
						  </view>
						</view>
						
				</scroll-view>
			</view>
		</u-popup>
		
	</view>
</template>

<script>
import Index from "@/common/index-model.js"	
let index = new Index()
let that = null
export default {
	data() {
		return {
			listRow:[],
			userJob:false,
			userListOrder:[],
			nickName:''
		}
	},
	methods:{
		//查询发布的信息条数
		exclusive(id) {
			let url="client/job/find/orders/"+id
			this.userListOrder = []
			index.getPublicUserMember({},url,'get',res=>{
				if(res.data.code == 200 && res.data.success){
					 let arr = res.data.result
					for(let i=0;i<arr.length;i++){
						arr[i].titleName = arr[i].address+'招'+arr[i].skills  //拼接地址+技能 = 列表标题
					   if(arr[i].welfare){
					   	arr[i].welfareNew = arr[i].welfare.split(',')
					   }else{
					   	arr[i].welfareNew=[]
					   }
					   this.userListOrder.push(arr[i])	
					}
				}else{
					this.userListOrder = []
				}
			})
		},
		closeJob() {
		    this.userJob = false;
		},
		openJob(item) {
			this.exclusive(item.userId);
			this.nickName=item.nickName;
			this.userJob =true
		},
		navUserOrderInfo(item) {
			let url="../../pagesB/jobinfo/index?id=" + item.id
			index.navigate_to(url) 
		},
		getListRow() {
			let send={"time":this.timestampToTime()}
			index.getPublicUserMember(send,'client/individual/pay/attention','post',res=>{
				  if(res.data.code == 200 && res.data.success){
					  this.listRow = res.data.result
				  }else{
					  this.listRow =[]
				  }
			}) 
		},
		timestampToTime() {
				var date = new Date();//时间戳为10位需*1000，时间戳为13位的话不需乘1000
				var Y = date.getFullYear()+'-';
				var M = (date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1)+'-';
				var D = date.getDate()<10?('0'+date.getDate()+' '):(date.getDate()+' ');
				var h = date.getHours()<10?('0'+date.getHours()+':'):(date.getHours()+':');
					var m = date.getMinutes()<10?('0'+date.getMinutes()+':'):(date.getMinutes()+':');
					var s = date.getSeconds()<10?('0'+date.getSeconds()):(date.getSeconds());
				// var m = date.getMinutes() + ':';
				// var s = date.getSeconds();
			    return Y+M+D+h+m+s;
		},
	},
	onLoad() {
		this.getListRow()
	}
}
</script>

<style>
@import url("@/static/css/publics.css");	
@import url("@/static/css/myfollow.css");
</style>
<style lang="scss" scoped>
	.userJobList{
		padding: 32rpx 20rpx;
		.scroll-Y {
			margin-top: 52rpx;
			max-height: 60vh;
		}
		.top{
			.user{
				display: flex;
				margin-bottom: 12rpx;
				image{
					width: 28rpx;
					height: 28rpx;
				}
				view{
					line-height: 32rpx;
					margin-left: 16rpx;
					font-size: 32rpx;
				}
			}
			.number{
				margin-left: 44rpx;
				color: #3D3D3D;
				font-size: 24rpx;
				text{
					color: #0575FF;
					margin-left: 8rpx;
				}
			}
		}
		.complist{
			// background-image: url('http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/comp-bg.png');
			background-repeat: no-repeat;
			background-position: bottom left;
		}
		.list {
		  padding: 0rpx 0rpx 0;
		  margin-bottom: 20rpx;
		  .title {
		    display: flex;
		    align-items: center;
		    text {
		      background: #ff5964;
		      color: #fff;
		      font-size: 20rpx;
		      padding: 8rpx 14rpx;
		      border-radius: 8rpx;
		    }
		    view {
		      font-size: 36rpx;
		      font-weight: bold;
		      // margin-left: 20rpx;
		    }
		  }
		  .cont {
		    margin: 20rpx 0;
		    font-size: 24rpx;
		    color: #424242;
		  }
		  .tag {
		    display: flex;
			flex-wrap: wrap;
		    view {
		      background: #f7f7f7;
		      border-radius: 8rpx;
		      font-size: 28rpx;
		      padding: 5rpx 10rpx;
		      margin-right: 10rpx;
		      color: #424242;
			  margin-bottom: 10rpx;
		    }
		    .t1 {
		      color: #ff5964;
		    }
		  }
		  .info {
		    padding-top: 20rpx;
		    padding-bottom: 30rpx;
		    margin-top: 20rpx;
		    align-items: baseline;
		    border-top: 0.5px solid #f0f0f0;
		    display: flex;
		    justify-content: space-between;
		    .left {
		      .top {
		        display: flex;
		        align-items: center;
		        .name {
		          color: #0f0f0f;
		          font-weight: bold;
		        }
		        image {
		          width: 28rpx;
		          height: 28rpx;
				  margin-left: 14rpx;
				  margin-right: 10rpx;
		        }
		        .authMe {
		          color: #a1a1a1;
		          font-size: 24rpx;
		        }
				.comp {
				  color: #d9a14e;
				  font-size: 24rpx;
				}
		      }
		      .addr {
		        display: flex;
		        color: #a1a1a1;
		        font-size: 24rpx;
		        margin-top: 10rpx;
		        ::v-deep {
		          .u-icon {
		            margin-right: 14rpx;
		          }
		        }
		      }
		    }
		    .right {
		      color: #0575FF;
			  font-size: 24rpx;
			  font-weight: 100rpx;
		    }
		  }
		}
	}
</style>